package dyyx;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;


@Service
public class HelloService {

	// @Autowired
	@Resource
    RestTemplate eurekaRestTemplate;

    @HystrixCommand(fallbackMethod = "error")
    public String hello(String name) {
    	Map<String,Object> map = new HashMap<>();
    	map.put("name", name);
        return eurekaRestTemplate.getForObject("http://provider/fegin/hello2",String.class,map);
    }

    public String error(String name) {
    	
        return "HelloService.hello fallback";
    }

}
